/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
import $protobuf from "protobufjs/minimal.js";

// Common aliases
const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;

// Exported root namespace
const $root = $protobuf.roots.extrabyte || ($protobuf.roots.extrabyte = {});

export const com = $root.com = (() => {

    /**
     * Namespace com.
     * @exports com
     * @namespace
     */
    const com = {};

    com.iamteer = (function() {

        /**
         * Namespace iamteer.
         * @memberof com
         * @namespace
         */
        const iamteer = {};

        iamteer.wcf = (function() {

            /**
             * Namespace wcf.
             * @memberof com.iamteer
             * @namespace
             */
            const wcf = {};

            wcf.Extra = (function() {

                /**
                 * Properties of an Extra.
                 * @memberof com.iamteer.wcf
                 * @interface IExtra
                 * @property {Array.<com.iamteer.wcf.Extra.IProperty>|null} [properties] Extra properties
                 */

                /**
                 * Constructs a new Extra.
                 * @memberof com.iamteer.wcf
                 * @classdesc Represents an Extra.
                 * @implements IExtra
                 * @constructor
                 * @param {com.iamteer.wcf.IExtra=} [properties] Properties to set
                 */
                function Extra(properties) {
                    this.properties = [];
                    if (properties)
                        for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                            if (properties[keys[i]] != null)
                                this[keys[i]] = properties[keys[i]];
                }

                /**
                 * Extra properties.
                 * @member {Array.<com.iamteer.wcf.Extra.IProperty>} properties
                 * @memberof com.iamteer.wcf.Extra
                 * @instance
                 */
                Extra.prototype.properties = $util.emptyArray;

                /**
                 * Creates a new Extra instance using the specified properties.
                 * @function create
                 * @memberof com.iamteer.wcf.Extra
                 * @static
                 * @param {com.iamteer.wcf.IExtra=} [properties] Properties to set
                 * @returns {com.iamteer.wcf.Extra} Extra instance
                 */
                Extra.create = function create(properties) {
                    return new Extra(properties);
                };

                /**
                 * Encodes the specified Extra message. Does not implicitly {@link com.iamteer.wcf.Extra.verify|verify} messages.
                 * @function encode
                 * @memberof com.iamteer.wcf.Extra
                 * @static
                 * @param {com.iamteer.wcf.IExtra} message Extra message or plain object to encode
                 * @param {$protobuf.Writer} [writer] Writer to encode to
                 * @returns {$protobuf.Writer} Writer
                 */
                Extra.encode = function encode(message, writer) {
                    if (!writer)
                        writer = $Writer.create();
                    if (message.properties != null && message.properties.length)
                        for (let i = 0; i < message.properties.length; ++i)
                            $root.com.iamteer.wcf.Extra.Property.encode(message.properties[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
                    return writer;
                };

                /**
                 * Encodes the specified Extra message, length delimited. Does not implicitly {@link com.iamteer.wcf.Extra.verify|verify} messages.
                 * @function encodeDelimited
                 * @memberof com.iamteer.wcf.Extra
                 * @static
                 * @param {com.iamteer.wcf.IExtra} message Extra message or plain object to encode
                 * @param {$protobuf.Writer} [writer] Writer to encode to
                 * @returns {$protobuf.Writer} Writer
                 */
                Extra.encodeDelimited = function encodeDelimited(message, writer) {
                    return this.encode(message, writer).ldelim();
                };

                /**
                 * Decodes an Extra message from the specified reader or buffer.
                 * @function decode
                 * @memberof com.iamteer.wcf.Extra
                 * @static
                 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
                 * @param {number} [length] Message length if known beforehand
                 * @returns {com.iamteer.wcf.Extra} Extra
                 * @throws {Error} If the payload is not a reader or valid buffer
                 * @throws {$protobuf.util.ProtocolError} If required fields are missing
                 */
                Extra.decode = function decode(reader, length) {
                    if (!(reader instanceof $Reader))
                        reader = $Reader.create(reader);
                    let end = length === undefined ? reader.len : reader.pos + length, message = new $root.com.iamteer.wcf.Extra();
                    while (reader.pos < end) {
                        let tag = reader.uint32();
                        switch (tag >>> 3) {
                        case 3: {
                                if (!(message.properties && message.properties.length))
                                    message.properties = [];
                                message.properties.push($root.com.iamteer.wcf.Extra.Property.decode(reader, reader.uint32()));
                                break;
                            }
                        default:
                            reader.skipType(tag & 7);
                            break;
                        }
                    }
                    return message;
                };

                /**
                 * Decodes an Extra message from the specified reader or buffer, length delimited.
                 * @function decodeDelimited
                 * @memberof com.iamteer.wcf.Extra
                 * @static
                 * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
                 * @returns {com.iamteer.wcf.Extra} Extra
                 * @throws {Error} If the payload is not a reader or valid buffer
                 * @throws {$protobuf.util.ProtocolError} If required fields are missing
                 */
                Extra.decodeDelimited = function decodeDelimited(reader) {
                    if (!(reader instanceof $Reader))
                        reader = new $Reader(reader);
                    return this.decode(reader, reader.uint32());
                };

                /**
                 * Verifies an Extra message.
                 * @function verify
                 * @memberof com.iamteer.wcf.Extra
                 * @static
                 * @param {Object.<string,*>} message Plain object to verify
                 * @returns {string|null} `null` if valid, otherwise the reason why it is not
                 */
                Extra.verify = function verify(message) {
                    if (typeof message !== "object" || message === null)
                        return "object expected";
                    if (message.properties != null && message.hasOwnProperty("properties")) {
                        if (!Array.isArray(message.properties))
                            return "properties: array expected";
                        for (let i = 0; i < message.properties.length; ++i) {
                            let error = $root.com.iamteer.wcf.Extra.Property.verify(message.properties[i]);
                            if (error)
                                return "properties." + error;
                        }
                    }
                    return null;
                };

                /**
                 * Creates an Extra message from a plain object. Also converts values to their respective internal types.
                 * @function fromObject
                 * @memberof com.iamteer.wcf.Extra
                 * @static
                 * @param {Object.<string,*>} object Plain object
                 * @returns {com.iamteer.wcf.Extra} Extra
                 */
                Extra.fromObject = function fromObject(object) {
                    if (object instanceof $root.com.iamteer.wcf.Extra)
                        return object;
                    let message = new $root.com.iamteer.wcf.Extra();
                    if (object.properties) {
                        if (!Array.isArray(object.properties))
                            throw TypeError(".com.iamteer.wcf.Extra.properties: array expected");
                        message.properties = [];
                        for (let i = 0; i < object.properties.length; ++i) {
                            if (typeof object.properties[i] !== "object")
                                throw TypeError(".com.iamteer.wcf.Extra.properties: object expected");
                            message.properties[i] = $root.com.iamteer.wcf.Extra.Property.fromObject(object.properties[i]);
                        }
                    }
                    return message;
                };

                /**
                 * Creates a plain object from an Extra message. Also converts values to other types if specified.
                 * @function toObject
                 * @memberof com.iamteer.wcf.Extra
                 * @static
                 * @param {com.iamteer.wcf.Extra} message Extra
                 * @param {$protobuf.IConversionOptions} [options] Conversion options
                 * @returns {Object.<string,*>} Plain object
                 */
                Extra.toObject = function toObject(message, options) {
                    if (!options)
                        options = {};
                    let object = {};
                    if (options.arrays || options.defaults)
                        object.properties = [];
                    if (message.properties && message.properties.length) {
                        object.properties = [];
                        for (let j = 0; j < message.properties.length; ++j)
                            object.properties[j] = $root.com.iamteer.wcf.Extra.Property.toObject(message.properties[j], options);
                    }
                    return object;
                };

                /**
                 * Converts this Extra to JSON.
                 * @function toJSON
                 * @memberof com.iamteer.wcf.Extra
                 * @instance
                 * @returns {Object.<string,*>} JSON object
                 */
                Extra.prototype.toJSON = function toJSON() {
                    return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
                };

                /**
                 * Gets the default type url for Extra
                 * @function getTypeUrl
                 * @memberof com.iamteer.wcf.Extra
                 * @static
                 * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
                 * @returns {string} The default type url
                 */
                Extra.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
                    if (typeUrlPrefix === undefined) {
                        typeUrlPrefix = "type.googleapis.com";
                    }
                    return typeUrlPrefix + "/com.iamteer.wcf.Extra";
                };

                /**
                 * PropertyKey enum.
                 * @name com.iamteer.wcf.Extra.PropertyKey
                 * @enum {number}
                 * @property {number} Field_0=0 Field_0 value
                 * @property {number} Sign=2 Sign value
                 * @property {number} Thumb=3 Thumb value
                 * @property {number} Extra=4 Extra value
                 * @property {number} Xml=7 Xml value
                 */
                Extra.PropertyKey = (function() {
                    const valuesById = {}, values = Object.create(valuesById);
                    values[valuesById[0] = "Field_0"] = 0;
                    values[valuesById[2] = "Sign"] = 2;
                    values[valuesById[3] = "Thumb"] = 3;
                    values[valuesById[4] = "Extra"] = 4;
                    values[valuesById[7] = "Xml"] = 7;
                    return values;
                })();

                Extra.Property = (function() {

                    /**
                     * Properties of a Property.
                     * @memberof com.iamteer.wcf.Extra
                     * @interface IProperty
                     * @property {com.iamteer.wcf.Extra.PropertyKey|null} [type] Property type
                     * @property {string|null} [value] Property value
                     */

                    /**
                     * Constructs a new Property.
                     * @memberof com.iamteer.wcf.Extra
                     * @classdesc Represents a Property.
                     * @implements IProperty
                     * @constructor
                     * @param {com.iamteer.wcf.Extra.IProperty=} [properties] Properties to set
                     */
                    function Property(properties) {
                        if (properties)
                            for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                                if (properties[keys[i]] != null)
                                    this[keys[i]] = properties[keys[i]];
                    }

                    /**
                     * Property type.
                     * @member {com.iamteer.wcf.Extra.PropertyKey} type
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @instance
                     */
                    Property.prototype.type = 0;

                    /**
                     * Property value.
                     * @member {string} value
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @instance
                     */
                    Property.prototype.value = "";

                    /**
                     * Creates a new Property instance using the specified properties.
                     * @function create
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @static
                     * @param {com.iamteer.wcf.Extra.IProperty=} [properties] Properties to set
                     * @returns {com.iamteer.wcf.Extra.Property} Property instance
                     */
                    Property.create = function create(properties) {
                        return new Property(properties);
                    };

                    /**
                     * Encodes the specified Property message. Does not implicitly {@link com.iamteer.wcf.Extra.Property.verify|verify} messages.
                     * @function encode
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @static
                     * @param {com.iamteer.wcf.Extra.IProperty} message Property message or plain object to encode
                     * @param {$protobuf.Writer} [writer] Writer to encode to
                     * @returns {$protobuf.Writer} Writer
                     */
                    Property.encode = function encode(message, writer) {
                        if (!writer)
                            writer = $Writer.create();
                        if (message.type != null && Object.hasOwnProperty.call(message, "type"))
                            writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type);
                        if (message.value != null && Object.hasOwnProperty.call(message, "value"))
                            writer.uint32(/* id 2, wireType 2 =*/18).string(message.value);
                        return writer;
                    };

                    /**
                     * Encodes the specified Property message, length delimited. Does not implicitly {@link com.iamteer.wcf.Extra.Property.verify|verify} messages.
                     * @function encodeDelimited
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @static
                     * @param {com.iamteer.wcf.Extra.IProperty} message Property message or plain object to encode
                     * @param {$protobuf.Writer} [writer] Writer to encode to
                     * @returns {$protobuf.Writer} Writer
                     */
                    Property.encodeDelimited = function encodeDelimited(message, writer) {
                        return this.encode(message, writer).ldelim();
                    };

                    /**
                     * Decodes a Property message from the specified reader or buffer.
                     * @function decode
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @static
                     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
                     * @param {number} [length] Message length if known beforehand
                     * @returns {com.iamteer.wcf.Extra.Property} Property
                     * @throws {Error} If the payload is not a reader or valid buffer
                     * @throws {$protobuf.util.ProtocolError} If required fields are missing
                     */
                    Property.decode = function decode(reader, length) {
                        if (!(reader instanceof $Reader))
                            reader = $Reader.create(reader);
                        let end = length === undefined ? reader.len : reader.pos + length, message = new $root.com.iamteer.wcf.Extra.Property();
                        while (reader.pos < end) {
                            let tag = reader.uint32();
                            switch (tag >>> 3) {
                            case 1: {
                                    message.type = reader.int32();
                                    break;
                                }
                            case 2: {
                                    message.value = reader.string();
                                    break;
                                }
                            default:
                                reader.skipType(tag & 7);
                                break;
                            }
                        }
                        return message;
                    };

                    /**
                     * Decodes a Property message from the specified reader or buffer, length delimited.
                     * @function decodeDelimited
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @static
                     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
                     * @returns {com.iamteer.wcf.Extra.Property} Property
                     * @throws {Error} If the payload is not a reader or valid buffer
                     * @throws {$protobuf.util.ProtocolError} If required fields are missing
                     */
                    Property.decodeDelimited = function decodeDelimited(reader) {
                        if (!(reader instanceof $Reader))
                            reader = new $Reader(reader);
                        return this.decode(reader, reader.uint32());
                    };

                    /**
                     * Verifies a Property message.
                     * @function verify
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @static
                     * @param {Object.<string,*>} message Plain object to verify
                     * @returns {string|null} `null` if valid, otherwise the reason why it is not
                     */
                    Property.verify = function verify(message) {
                        if (typeof message !== "object" || message === null)
                            return "object expected";
                        if (message.type != null && message.hasOwnProperty("type"))
                            switch (message.type) {
                            default:
                                return "type: enum value expected";
                            case 0:
                            case 2:
                            case 3:
                            case 4:
                            case 7:
                                break;
                            }
                        if (message.value != null && message.hasOwnProperty("value"))
                            if (!$util.isString(message.value))
                                return "value: string expected";
                        return null;
                    };

                    /**
                     * Creates a Property message from a plain object. Also converts values to their respective internal types.
                     * @function fromObject
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @static
                     * @param {Object.<string,*>} object Plain object
                     * @returns {com.iamteer.wcf.Extra.Property} Property
                     */
                    Property.fromObject = function fromObject(object) {
                        if (object instanceof $root.com.iamteer.wcf.Extra.Property)
                            return object;
                        let message = new $root.com.iamteer.wcf.Extra.Property();
                        switch (object.type) {
                        default:
                            if (typeof object.type === "number") {
                                message.type = object.type;
                                break;
                            }
                            break;
                        case "Field_0":
                        case 0:
                            message.type = 0;
                            break;
                        case "Sign":
                        case 2:
                            message.type = 2;
                            break;
                        case "Thumb":
                        case 3:
                            message.type = 3;
                            break;
                        case "Extra":
                        case 4:
                            message.type = 4;
                            break;
                        case "Xml":
                        case 7:
                            message.type = 7;
                            break;
                        }
                        if (object.value != null)
                            message.value = String(object.value);
                        return message;
                    };

                    /**
                     * Creates a plain object from a Property message. Also converts values to other types if specified.
                     * @function toObject
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @static
                     * @param {com.iamteer.wcf.Extra.Property} message Property
                     * @param {$protobuf.IConversionOptions} [options] Conversion options
                     * @returns {Object.<string,*>} Plain object
                     */
                    Property.toObject = function toObject(message, options) {
                        if (!options)
                            options = {};
                        let object = {};
                        if (options.defaults) {
                            object.type = options.enums === String ? "Field_0" : 0;
                            object.value = "";
                        }
                        if (message.type != null && message.hasOwnProperty("type"))
                            object.type = options.enums === String ? $root.com.iamteer.wcf.Extra.PropertyKey[message.type] === undefined ? message.type : $root.com.iamteer.wcf.Extra.PropertyKey[message.type] : message.type;
                        if (message.value != null && message.hasOwnProperty("value"))
                            object.value = message.value;
                        return object;
                    };

                    /**
                     * Converts this Property to JSON.
                     * @function toJSON
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @instance
                     * @returns {Object.<string,*>} JSON object
                     */
                    Property.prototype.toJSON = function toJSON() {
                        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
                    };

                    /**
                     * Gets the default type url for Property
                     * @function getTypeUrl
                     * @memberof com.iamteer.wcf.Extra.Property
                     * @static
                     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
                     * @returns {string} The default type url
                     */
                    Property.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
                        if (typeUrlPrefix === undefined) {
                            typeUrlPrefix = "type.googleapis.com";
                        }
                        return typeUrlPrefix + "/com.iamteer.wcf.Extra.Property";
                    };

                    return Property;
                })();

                return Extra;
            })();

            return wcf;
        })();

        return iamteer;
    })();

    return com;
})();

export default $root;
